<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="css/lib/bootstrap.min.css" />
		<script src="js/jquery.min.js"></script>
		<script src="js/lib/bootstrap.min.js"></script>
		<script src="js/lib/vue.min.js"></script>
		<script src="js/lib/vue-resource.js"></script>
		<script src="js/base.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<style>
		body{
			font-size:12px;
		}
		
		table tr:nth-child(1) {
			background-color:#f1f1f1;
		}
		table tr:nth-child(2) {
			background-color:#f1f1f1;
		}
		table tr:nth-child(3) {
			background-color:#f1f1f1;
		}
		td {
			border: 1px solid #eee;
			border-collapse: collapse;
			padding: 5px;
			vertical-align: middle !important;
		}		
		.btn{
			padding:2px 3px;
		}
		#tan{
			width:600px;
			height:400px;
			position:fixed;
			left:200px;
			top:50px;
			background:#000000;
			opacity: 0.8;
			z-index:1000;
			display:none;
		}
		#tantwo{
			width:600px;
			height:500px;
			position:fixed;
			left:200px;
			top:10px;
			background:#000000;
			opacity: 0.8;
			z-index:1000;
			display:none;
		}
		#tanth{
			width:600px;
			height:500px;
			position:fixed;
			left:200px;
			top:10px;
			background:#000000;
			opacity: 0.8;
			z-index:1000;
			display:none;
			border-radius:15px;
			box-shadow:1px 5px 50px 5px ;
		}
		#bbt{
			position:absolute;
			right:0;
			top:0
		}
	</style>
	<body>
		<div class="" id="box" style="position:relative;">		
		<div style="padding:15px 5px 0px 5px;border:3px solid #ccc;margin-bottom:15px">
			<table class="table table-hover">				
				<tbody>
					<tr>
						<th colspan="13" style="font-size:26px;color:#337ab7">管理所有的下级会员+：</th>
					</tr>					
					<tr style="font-size:15px;">
						<!--<td colspan="13">
							手机号：<input class="form-control" style="width:150px;display:inline-block" type="text" name="" id="" v-model="ph" value="" /><button v-on:click="shouji()" class="btn btn-default" style="margin-left:2px;">查询</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id="error" style="color:red"></span>
							身份证：<input type="text" v-model="idcade" class="form-control" style="width:180px;display:inline-block;margin-right:0px;">
							      <button id="code" v-on:click="shen()" class="btn btn-default" style="margin-right:0px;">查询</button>
							审核状态：<select name="" id="sel" v-on:change="xuan()" class="form-control" style="width:120px;display:inline-block;margin-right:10px;">
								<option value="">请选择</option>
							    <option value="0">未审核</option>
								<option value="1">审核通过</option>
								<option value="2">审核失败</option>
							    <option value="3">未提交</option>
							</select>
							 	<input type="date" v-model="star" class="form-control" style="width:150px;display:inline-block"> -
								<input type="date" v-model="end" class="form-control" style="width:150px;display:inline-block">
										<button v-on:click="date()" id="date" class="btn btn-default" style="margin-left:20px;">查询</button>
							<select name="" id="s" v-on:change="ji()" class="form-control" style="width:120px;display:inline-block;margin-right:20px;">
									<option value="0">消费者</option>
							</select>
						</td>	-->
						<td colspan="13">
							<span>手机号：</span>
							<input class="form-control" style="width:150px;display:inline-block" type="text" name="" id="" v-model="filter.phone" value="" />
							<span>姓名：</span>
							<input class="form-control" style="width:150px;display:inline-block" type="text" name="" id="" v-model="filter.fullname" value="" />
							<span>开始时间：</span>
							<input type="date" v-model="filter.startTime" class="form-control" style="width:150px;display:inline-block">
							<span>实名状态：</span>
							<select v-model="filter.realnameStatus">
								<option v-for="item in realname_status" :key="item.value" :value="item.value">{{item.label}}</option>
							</select>
							<span>商户状态：</span>
							<select v-model="filter.usershopStatus" >
								<option v-for="item in shop_status" :key="item.value" :value="item.value">{{item.label}}</option>
							</select>
							
							<button @click="handleQuery">查询</button>
						</td>
					</tr>
					
					<tr>
		                <td colspan="16">
		                    <span style="color:#000;font-weight:600;">今日新增：</span><span style="display:inline-block;width:80px;" id="nums">加载中...</span>
		                    <span style="color:#000;font-weight:600;">注册会员数：</span><span style="display:inline-block;width:80px;" id="num0">{{num0}}</span>
		                    <span style="color:#000;font-weight:600;">已实名会员数：</span><span style="display:inline-block;width:80px;" id="num1">加载中...</span>
		                     <span style="color:#000;font-weight:600;">待审核：</span><span style="display:inline-block;width:80px;" id="num2">加载中...</span>
		                </td>
		            </tr>
					<!-- <tr style="font-size:15px;">
						<td colspan="13">
							商户号：
							<input class="form-control" style="width:200px;display:inline-block;margin-right:20px;" type="text">
							<button class="btn btn-default" style="margin-right:20px;" v-on:click="">查询</button>
							银行卡号：
							<input class="form-control" v-model="card" style="width:200px;display:inline-block;margin-right:20px;" type="text">
							<button class="btn btn-default" style="margin-right:20px;" v-on:click="cardno()">查询</button>
							代理等级:						
						</td>
					</tr> -->
					<tr class="text-center" style="font-size:13px;background:#f1f1f1">
						<td style="width:45px">序号</td>
						<td>注册日期</td>
						<td>手机号码</td>
						<td>真实姓名</td>
						<td>实名状态</td>
						<td>商户状态</td>
						<td>总分润/账户余额/消费总额</td>
						<td>代理等级</td>
						<!--<td>登陆权限</td>-->
						<td>查看上级</td>
						<td>费率</td>
						<td>变更级别</td>						
						<!-- <td>实名审核</td> -->
						<!-- <td>商户审核</td> -->
						<td>信息备注</td>
					</tr>
					<tr class="text-center" v-for="(i,index) in list">						
						<td style="width:30px">{{index+1}}</td>
						<td>{{i.createTime | time}}</td>
						<td>{{i.phone}}</td>
						<td>{{i.fullname}}</td>
						<td>{{i.realnameStatus | todo2}}</td>
						<td>{{i.usershopStatus | todo2}}</td>
						<td class="text-left">{{i.rebateSum+"元/"+i.balance+"元/"+i.coin+"元"}}</td>
						<td>{{i.grade}}级</td>
						<!--<td>
							<a href="用户角色权限管理新增.html" v-if="roleId<3"><button class="btn btn-default" v-on:click="mv(i)">更改权限</button></a>
							<button v-else class="btn btn-default">无权限</button>
						</td>-->
						<td><button class="btn btn-default" v-on:click="shang(i)">查看上级</button></td>
						<td><a href="用户费率.html"><button class="btn btn-default" v-on:click="mk(i)">查看费率</button></a></td>
						<td><button class="btn btn-default" v-on:click="mm(i)">变更</button></td>
						<!-- <td><a><button class="btn btn-default" v-on:click="mc(i)">审核</button></a></td> -->
						<!-- <td><a href="shenhe2.html"><button class="btn btn-default" v-on:click="mc2(i)">审核</button></a></td> -->
						<td><button class="btn btn-default" v-on:click="bz(i)">备注</button></td>
					</tr>
					<tr v-if="!list">
						<td colspan="15" class="text-center" >
							<div style="height: 100px;line-height: 100px;">
								暂无数据
							</div>
							
						</td>
					</tr>
					<tr>
						<td colspan="15" class="text-center">
							第<input class="form-control" id="ye" v-model="ye1" style="width:35px;display:inline-block" placeholder="1" type="text"/>页
							<button class="btn btn-default" v-on:click="xia()">跳转</button>
							总共{{pages}}条数据    共{{page}}页
							<button class="btn btn-default" v-on:click="home()">首页</button>
							<button class="btn btn-default" v-on:click="sh()">上一页</button>
							<button class="btn btn-default" v-on:click="next()">下一页</button>
							<button class="btn btn-default" v-on:click="last(page)">尾页</button>
						</td>
					</tr>
					<tr>
						<td style="color:red" colspan="15">
							PS备注信息功能请慎重使用！会即时推送到当前备注用户
						</td>
					</tr>
				</tbody>
			</table>		
		</div>
		<div id="tan">
			<h4 style="color:#fff;text-align: center;">修改信息</h4>
			<button v-on:click="gb" style="position:absolute;top:0;right:0">关闭</button>
			<table border="" cellspacing="" cellpadding="" >
				<p style="color:#fff;margin-left:10%">用户编号：</p>
				<input v-model="m1" type="text" class="form-control" style="width:80%;margin:0 auto"/><br/>
				<p style="color:#fff;margin-left:10%">用户名：</p>
				<input v-model="m2" type="text" class="form-control" style="width:80%;margin:0 auto"/><br/>
				<p style="color:#fff;margin-left:10%">用户手机:</p>
				<input v-model="m3" type="text" class="form-control" style="width:80%;margin:0 auto"/><br/>
				<p style="color:#fff;margin-left:10%">用户等级：</p>								
				<select v-model="m4" class="form-control" style="width:80%;margin:0 auto" name="">
													
					<option v-for="li of lists" :value="li.grade">{{li.name}}</option>
					<option value="0">消费者</option>	
				</select>
				<button v-on:click="ti(m1,m4)" class="btn btn-danger" style="margin:0 auto;display:block">提交</button>
			</table>			
		</div>
		<div id="tantwo">
			<h4 style="color:#fff;text-align: center;">上级信息</h4>
			<button v-on:click="gbtwo()" style="position:absolute;top:0;right:0">关闭</button>
			<table border="" cellspacing="" cellpadding="">
				<p style="color:#fff;margin-left:10%">上级用户id：</p>
				<input id="s1" v-model="s1" type="text" class="form-control" style="width:80%;margin:0 auto"/><br/>
				<p style="color:#fff;margin-left:10%">上级用户手机</p>
				<input id="s2" v-model="s2" type="text" class="form-control" style="width:80%;margin:0 auto"/><br/>
				<p style="color:#fff;margin-left:10%">上上级用户id:</p>
				<input id="s3" v-model="s3" type="text" class="form-control" style="width:80%;margin:0 auto"/><br/>
				<p style="color:#fff;margin-left:10%">上上级用户手机:</p>
				<input id="s4" v-model="s4" type="text" class="form-control" style="width:80%;margin:0 auto"/>	
				<p style="color:#fff;margin-left:10%">上上上级用户id:</p>
				<input id="s5" v-model="s5" type="text" class="form-control" style="width:80%;margin:0 auto"/><br/>
				<p style="color:#fff;margin-left:10%">上上上级用户手机:</p>
				<input id="s6" v-model="s6" type="text" class="form-control" style="width:80%;margin:0 auto"/>	
			</table>			
		</div>
			<div id="tanth">
				<h4 style="color:#fff;text-align: center;">用户<sapn style="color:green" id="realname"></sapn>的信息备注</h4>
				<button id="bbt" v-on:click="bbt()">×</button>
                <textarea name="" id="text" cols="85" rows="22" style="margin:0 auto;display:block;">

                </textarea>
                <button id="tijiao" v-on:click="tj()" class="btn btn-default" style="display: block;margin:10px auto;">提交</button>
			</div>
		</div>
	</body>
	<script>
		$(function(){
			var brandid = sessionStorage.getItem(key=3);
			var token = sessionStorage.getItem(1);
			$.ajax({
					url:window.baseUrl+'user/thirdlevel/prod/brand/'+brandid + '/' + token,					
					datatype:'json',					
					type:'GET',					
					data:{},									
					success:function(data){
						console.log(data)
						console.log(data.result)
						var arr = [];

						/*
						if(data.result.length == 3){
							var c = data.result[0].name;
							var b = data.result[1].name;
							var a = data.result[2].name;
							console.log(a+","+b+","+c);
							sessionStorage.setItem(80,"消费者")
							sessionStorage.setItem(81,a)
			        		sessionStorage.setItem(82,b)
			        		sessionStorage.setItem(83,c)
						}
						if(data.result.length == 4){
							var d = data.result[0].name;
							var c = data.result[1].name;
							var b = data.result[2].name;
							var a = data.result[3].name;
							sessionStorage.setItem(80,"消费者")
							sessionStorage.setItem(81,a)
			        		sessionStorage.setItem(82,b)
			        		sessionStorage.setItem(83,c)
			        		sessionStorage.setItem(84,d)
						}
						if(data.result.length == 5){
							var a = data.result[0].name;
							var b = data.result[1].name;
							var c = data.result[2].name;
							var d = data.result[3].name;
							var e = data.result[4].name;
							sessionStorage.setItem(80,"消费者")
							sessionStorage.setItem(85,a)
			        		sessionStorage.setItem(84,b)
			        		sessionStorage.setItem(83,c)
			        		sessionStorage.setItem(82,d)
			        		sessionStorage.setItem(81,e)
						}
						*/
		        		/*sessionStorage.setItem(f,f)*/
						var html = "<option selected='selected' value=''>请选择</option>";
		                var vendorJson = eval(data.result);
		                for(var i=0; i<vendorJson.length; i++){
		                html += "<option value= '"+vendorJson[i].grade+"'>"+vendorJson[i].name+"</option>";
		                }
		                $("#s").html('').append(html);
					},
					error:function(data){
						console.log('开户失败！')
					}
			})
			/*自定义时间戳*/
		Vue.filter('time', function (value) {//value为13位的时间戳
		    function add0(m) {
		        return m < 10 ? '0' + m : m
		    }
		    var time = new Date(parseInt(value));
		    var y = time.getFullYear();
		    var m = time.getMonth() + 1;
		    var d = time.getDate();		
		    return y + '-' + add0(m) + '-' + add0(d);
		});
	
			/*自定义过滤器*/
		var xx = {
			a:sessionStorage.getItem(80),
			b:sessionStorage.getItem(81),
			c:sessionStorage.getItem(82),
			d:sessionStorage.getItem(83),
			e:sessionStorage.getItem(84),
			f:sessionStorage.getItem(85)
		}
		console.log(xx)
		Vue.filter("todo",function(value){
			if(value == 0){
				return value = sessionStorage.getItem(80)
			}
			if(value == 1){
				return value = sessionStorage.getItem(81)
			}
			if(value == 2){
				return value = sessionStorage.getItem(82)
			}
			if(value == 3){
				return value = sessionStorage.getItem(83)
			}
			if(value == 4){
				return value = sessionStorage.getItem(84)
			}
			if(value == 5){
				return value = sessionStorage.getItem(85)
			}
			if(value == 6){
				return value = sessionStorage.getItem(86)
			}
		})
		/*自定义过滤器*/	
		Vue.filter("todo2",function(value){
			if(value == 0){
				return value = "未审核"
			}
			if(value == 1){
				return value = "已通过  √"
			}
			if(value == 2){
				return value = "审核失败×"
			}
			if(value == 3){
				return value = "未提交"
			}
		});
	new Vue({
				el:"#box",
				data: {
					list:[],
					lists:[],
					token:"",
					realname_status:[
					{value:"",label:"全部"},
			          {value:0,label:"未审核"},
			          {value:1,label:"审核通过"},
			          {value:2,label:"审核失败"},
			          {value:3,label:"未提交"},
			        ],
			        shop_status:[
			        {value:"",label:"全部"},
			          {value:0,label:"未审核"},
			          {value:1,label:"审核通过"},
			          {value:2,label:"审核失败"},
			          {value:3,label:"未提交"}
			        ],
					filter:{
						phone:"",
						fullname:"",
						startTime:"",
						realnameStatus:"",
						usershopStatus:""
					},
					roleId:"5",
					m1:"",
					m2:"",
					m3:"",
					m4:0,
					s1:"",
					s2:"",
					s3:"",
					s4:"",
					s5:"",
					s6:"",
					ph:"",
					ye:"",
					pages:"",
					page:"",
                    i:"",
					num:"",
					num0:"加载中...",
					ye1:1,
                    idcade:"",
					card:"",
					star:"",
					end:"",
					ss:[]
				},
				created:function(){/*生命周期函数*/
					let token = sessionStorage.getItem(key=1);
					let roleId = sessionStorage.getItem(key=5);
					this.roleId = roleId;
						this.$http.post(window.baseUrl+"user/afer/"+token,{roleId,size:10,page:this.ye1-1},{emulateJSON:true}).then(
								   function (res){ 
//								   		console.log(res)
//									    console.log(res.data.result)								    
									    if(res.data.result==null){
									    	alert("暂无下级会员")
									    }else{
									    	this.list = res.data.result.content;
									    	this.pages = res.data.result.totalElememts;
									    	this.num0 = res.data.result.totalElememts;
									    	console.log(res.data.result.number);
									    	this.page  = res.data.result.totalpages;
									    	this.num  =  res.data.result.number;
									    }
								   },function (res){ 
								   	console.log(res)
								   	alert("查询失败！");
								   } 
								  );
						this.$http.post(window.baseUrl+"user/query/querynamebystatus",{brand_id:brandid,realnameStatus:1/*获取所有级别//0审核中,1通过,2失败,3未提交	*/
						},{emulateJSON:true}).then(
								   function (res) { 
									    this.num1 = res.data.result
									    console.log(this.num1)
									    $('#num1').html(this.num1)
								   },function (res) { 
								   	console.log(res)
								   	alert("查询失败！")
								   } 
								  );
						var data = {brand_id:brandid,realnameStatus:0}/*获取所有级别//0审核中,1通过,2失败,3未提交	*/
						console.log(data)
						this.$http.post(window.baseUrl+"user/query/querynamebystatus",data,{emulateJSON:true}).then(
								   function (res) { 
									    this.num2 = res.data.result
									    console.log(this.num2)
									    if(this.num2 == undefined){
									    	this.num2 = 0
									    };
									    $('#num2').html(this.num2)
								   },function (res) { 
								   	console.log(res)
								   	alert("查询失败！")
								   } 
								  );
						var data = {brand_id:brandid}/*获取所有级别//0审核中,1通过,2失败,3未提交	*/
						console.log(data)
						this.$http.post(window.baseUrl+"user/query/querynamebystatus",data,{emulateJSON:true}).then(
						   function (res) { 
							    this.nums = res.data.result
							    console.log(this.nums)
							    if(this.nums == undefined){
							    	this.nums = 0
							    };	
							    $('#nums').html(this.nums);
						   },function (res) { 
						   	console.log(res)
						   	alert("查询失败！")
						   } 
						  );
				},
				methods:{
					handleQuery(){
						let token = sessionStorage.getItem(key=1);
						let roleId = sessionStorage.getItem(key=5);
						let url = window.baseUrl+"user/afer/"+token;
//						let params = `roleId=${roleId}&size=10&page=${this.ye1-1}`;
						let params = {};
						params.roleId = roleId;
						params.page = this.ye1-1;
						params.size = 10;
						for(let key in this.filter){
							if(this.filter[key]!==null && this.filter[key]!==''){
								if(key==="startTime"){
									params[key]=this.filter[key].split('-').join('/');
								}else{
									params[key]=this.filter[key];
								}
								
							}
						}
				
						this.$http.post(url,params,{emulateJSON:true}).then(res=>{
							if(res.data.resp_code==="000000" ){
								if( res.data.result==null){
									alert("暂无下级会员")
								}else{
							    	this.list = res.data.result.content;
							    	this.pages = res.data.result.totalElememts;
							    	this.num0 = res.data.result.totalElememts;
							    	this.page  = res.data.result.totalpages;
							    	this.num  =  res.data.result.number;
							   }
						    }
						}).catch(err=>{
							alert("服务器繁忙!")
						})
						
					},
				    /*开始时间 结束时间搜索*/
					date:function(){
					  	console.log(this.star);
						console.log(this.end);
                        this.$http.post(window.baseUrl+"user/info/"+token,{start_time:this.star,end_time:this.end,size:100},{emulateJSON:true}).then(
                            function (res){
                                console.log(res);
                                console.log(res.data.result.content);
                                this.list = res.data.result.content;
                                this.pages = res.data.result.totalElememts;
                                console.log(res.data.result.number);
                                this.page  = res.data.result.totalpages;
                                this.num  =  res.data.result.number;

                            },function (res) {
                                console.log(res);
                                alert("查询失败！")
                            }
                        );
					},
				    /*银行卡号搜索*/
				    cardno:function(){
                        this.$http.post(window.baseUrl+"user/info/"+token,{size:100,cardNo:this.card},{emulateJSON:true}).then(
                            function (res){
                                console.log(res);
                                console.log(res.data.result.content);
                                this.list = res.data.result.content;
                                this.pages = res.data.result.totalElememts;
                                console.log(res.data.result.number);
                                this.page  = res.data.result.totalpages;
                                this.num  =  res.data.result.number;

                            },function (res) {
                                console.log(res);
                                alert("查询失败！")
                            }
                        );
					},
				    /*代理商级别搜索*/
				    ji:function(){
                        var s = $('#s').find('option:selected').val();/*获取代理级别编号*/
						console.log(s);
                        this.$http.post(window.baseUrl+"user/info/"+token,{size:100,grade:s},{emulateJSON:true}).then(
                            function (res){
                                console.log(res);
                                console.log(res.data.result.content);
                                this.list = res.data.result.content;
                                this.pages = res.data.result.totalElememts;
                                console.log(res.data.result.number);
                                this.page  = res.data.result.totalpages;
                                this.num  =  res.data.result.number;

                            },function (res) {
                                console.log(res);
                                alert("查询失败！")
                            }
                        );
					},
				    /*审核状态搜索*/
                    xuan:function(){
                        token = sessionStorage.getItem(key=1);
                        var sel = $('#sel').find('option:selected').val();
                        console.log(sel);
                        this.ye1 = 1;
                        this.$http.post(window.baseUrl+"user/info/"+token,{size:100,realnameStatus:sel,page:this.ye1-1},{emulateJSON:true}).then(
                            function (res){
                                console.log(res);
                                console.log(res.data.result.content);
                                this.list = res.data.result.content;
                                this.pages = res.data.result.totalElememts;
                                console.log(res.data.result.number);
                                this.page  = res.data.result.totalpages;
                                this.num  =  res.data.result.number;

                            },function (res) {
                                console.log(res);
                                alert("查询失败！")
                            }
                        );
                    },
					/*身份证查询*/
					shen:function(){
                        this.$http.post(window.baseUrl+"user/info/"+token,{size:100,idcard:this.idcade},{emulateJSON:true}).then(
                            function (res){
                                console.log(res)
                                console.log(res.data.result.content)
                                this.list = res.data.result.content;
                                this.pages = res.data.result.totalElememts;
                                console.log(res.data.result.number);
                                this.page  = res.data.result.totalpages;
                                this.num  =  res.data.result.number;

                            },function (res) {
                                console.log(res);
                                alert("查询失败！")
                            }
                        );
					},
				    /*打开备注面板*/
				    bz:function (i) {
				        $('#tanth').animate({height:'toggle'});
						$('#tanth').css("display","block");
                        console.log(i.userid);
				        var id = i.userid;
				        var realname = i.realname;
						console.log(realname);
						$('#realname').html(realname)
                        sessionStorage.setItem(40,id);
                        /*接口前缀*/
                        var url01 = "http://192.168.1.120:80";
                        var url02 = window.baseUrl;
                        $.ajax({
                            url:url02+"user/query/id",
                            type:"post",
                            dataType:"json",
                            data:{
                                id:i.userid
                            },
                            success:function(data){
                                console.log("调用用户成功");
                                console.log(data);
                                console.log(data.result.remarks);
                                if(data.result == null){
                                     $('#text').val("没有备注信息")
                                }else{
                                    if(data.result.remarks == null ){
                                        $('#text').val("暂无备注信息")
                                    }else{
                                        $('#text').val(data.result.remarks)
                                    }

                                }                         
                            },
                            error:function(data){
                                console.log("接口调用失败！")
                            }
                        })
                    },
					/*关闭备面板*/
                    bbt:function(){
						$('#tanth').css('display','none')
					},
                    /*提交备注信息*/
                    tj:function(){
                        /*接口前缀*/
                        var url01 = "http://192.168.1.120:80";
                        var url02 = window.baseUrl;
                        /*添加备注的接口*/
                        var txt = $('#text').val();
                        var id = sessionStorage.getItem(key=40);
                        console.log(id);
                        console.log(txt);
                        $.ajax({
                            url:url02+"user/update/remarks",
                            type:"post",
                            dataType:"json",
                            data:{
                                userId:id,
                                remarks:txt
                            },
                            success:function(data){
                                console.log("接口调用成功");
                                console.log(data);
                                alert("成功保存用户备注信息")
                            },
                            error:function(data){
                                console.log("接口调用失败！");
								alert("出错了！")
                            }
                        })
                    },
					/*上一页*/
					sh:function(){
                        this.ye1-=1;
                        console.log(this.ye1);
                        if(this.ye1 <= 0){
							this.ye1 = 1
						}
                        this.$http.post(window.baseUrl+"user/info/"+token,{size:10,page:this.ye1-1},{emulateJSON:true}).then(
                            function (res){
                                console.log(res);
                                console.log(res.data.result)	;
                                this.list = res.data.result.content;
                                this.pages = res.data.result.totalElememts;
                                console.log(res.data.result.totalElememts);
                                this.page  = res.data.result.totalpages;
                            },function (res) {
                                console.log(res);
                                alert("查询失败！")
                            }
                        );
					},
                    next:function(){/*下一页*/
							this.ye1+=1;
							console.log(this.ye1)
                        this.$http.post(window.baseUrl+"user/info/"+token,{size:10,page:this.ye1-1},{emulateJSON:true}).then(
                            function (res){
                                console.log(res);
                                console.log(res.data.result)	;
                                this.list = res.data.result.content;
                                this.pages = res.data.result.totalElememts;
                                console.log(res.data.result.totalElememts);
                                this.page  = res.data.result.totalpages;
                            },function (res) {
                                console.log(res);
                                alert("查询失败！")
                            }
                        );
					},
					/*首页*/
					home:function(){
					    this.ye1 = 1;
                        this.$http.post(window.baseUrl+"user/info/"+token,{size:10,page:this.ye1-1},{emulateJSON:true}).then(
                            function (res){
                                console.log(res);
                                console.log(res.data.result)	;
                                this.list = res.data.result.content;
                                this.pages = res.data.result.totalElememts;
                                console.log(res.data.result.totalElememts);
                                this.page  = res.data.result.totalpages;
                            },function (res) {
                                console.log(res);
                                alert("查询失败！")
                            }
                        );

					},
					/*尾页*/
					last:function(page){
					    this.ye1 = page
                        this.$http.post(window.baseUrl+"user/info/"+token,{size:10,page:this.ye1-1},{emulateJSON:true}).then(
                            function (res){
                                console.log(res);
                                console.log(res.data.result)	;
                                this.list = res.data.result.content;
                                this.pages = res.data.result.totalElememts;
                                console.log(res.data.result.totalElememts);
                                this.page  = res.data.result.totalpages;
                            },function (res) {
                                console.log(res);
                                alert("查询失败！")
                            }
                        );
					},
					/*点击到那一页*/
					xia:function(){
						token = sessionStorage.getItem(key=1);
						var ye = this.ye-1;
						console.log(ye);
						this.$http.post(window.baseUrl+"user/info/"+token,{size:10,page:this.ye1-1},{emulateJSON:true}).then(
								   function (res){ 
								   		console.log(res);
									    console.log(res.data.result)	;
									    this.list = res.data.result.content;									    	
								    	this.pages = res.data.result.totalElememts;
								    	console.log(res.data.result.totalElememts);
								    	this.page  = res.data.result.totalpages;	
								   },function (res) { 
								   	console.log(res);
								   	alert("查询失败！")
								   } 
								  );
					},
					/*根据手机号码搜索用户*/
					shouji:function(){						
						token = sessionStorage.getItem(key=1);
						console.log(token);
						var ph = this.ph;
						console.log(ph);
						this.$http.post(window.baseUrl+"user/info/"+token,{phone:ph},{emulateJSON:true}).then( 
								   function (res){ 
								   		console.log(res);
									    console.log(res.data.result);
									    if(res.data.resp_code == 000000){
									    	this.list = res.data.result.content;
									    	$("#error").text("")
									    } 
									    if(res.data.resp_code == 000007){
									    	$("#error").text("用户不存在！")
									    }
								   },function (res) { 
								   	console.log(res);
								   	alert("查询失败！")
								   } 
								  );
					},
					/*查看下级会员*/
					cha:function(){
						token = sessionStorage.getItem(key=1);
						var phone = this.ph;
						console.log(phone);
						console.log('点击查询。。。');
						this.$http.post(window.baseUrl+"user/info/"+token,{},{emulateJSON:true}).then( 
								   function (res) { 
								   		console.log(res);
									    console.log(res.data.result);
									    if(res.data.result.length<=0){
									    	alert("暂无下级会员")
									    }else{
									    	this.list = res.data.result
									    }
								   },function (res) { 
								   	console.log(res)
								   	alert("查询失败！")
								   } 
								  );
					},
					/**/
					mm:function(i){
						var brandid = sessionStorage.getItem(key=3)
						var token = sessionStorage.getItem(1);
						$("#tan").css("display","block")
						this.$http.get(window.baseUrl+"user/thirdlevel/prod/brand/"+brandid + '/' + token,{/*获取所有级别*/
						},{emulateJSON:true}).then(
						   function (res) { 
						   		console.log(res)
							    console.log(res.data.result)
							    this.lists = res.data.result.tld
							    console.log(this.lists)
						   },function (res) { 
						   	console.log(res)
						   	alert("查询失败！")
						   } 
						  );
						this.m1 = i.userid;
						this.m2 = i.realname;
						this.m3 = i.phone;
						this.m4 = i.grade;
					},
					gb:function(){
						$("#tan").css("display","none")
					},
					ti:function(m1,m4){
						
						var m1 = m1;
						var m4 = m4;
						console.log(m1,m4)
						
						this.$http.post(window.baseUrl+"user/grade/update",{/*更改用户级别*/
							id:m1,grade:m4
						},{emulateJSON:true}).then(
								   function (res) { 
								   		console.log(res)
									    console.log(res.data.result)								    
									alert("更改级别成功！")
									/*location.reload()*/
								   },function (res) { 
								   	console.log(res)
								   	alert("更改级别失败！")
								   } 
								  );
					},
					mc:function(m3){
						console.log(m3.phone);
						sessionStorage.setItem(12,m3.phone)/*手机号*/
						sessionStorage.setItem(20,m3.idcard)/*身份证号码*/
						sessionStorage.setItem(21,m3.bankName)/*银行名称*/
						sessionStorage.setItem(22,m3.cardNo)/*银行卡号*/
						sessionStorage.setItem(23,m3.realname)/*真实姓名*/
						/*sessionStorage.setItem(24,m3.phone)*/
						window.open("shenhe.html")
					},
					mc2:function(i){
						console.log(i.userid)
						sessionStorage.setItem(13,i.userid)
					},
					mk:function(i){
						console.log(i.userid)
						sessionStorage.setItem(13,i.userid)
					},
					mv:function(i){
						console.log(i.userid)
						sessionStorage.setItem(33,i.userid)
					},
					shang:function(i){
						var userid = i.userid;
						$('#tantwo').css('display','block');
						$.ajax({
							type:"GET",
							url:window.baseUrl+"user/superior/userid",
							async:true,
							data:{
								userid:userid
							},
							success:function(data){
								console.log(data)
								this.ss = data.result
								console.log(this.ss)
								if(this.ss.length ==1){
									this.s1 = this.ss[0].userid;
									this.s2 = this.ss[0].phone;
									$('#s1').val(this.s1)
									$('#s2').val(this.s2)
								}
								if(this.ss.length ==2){
									this.s1 = this.ss[0].userid;
									this.s2 = this.ss[0].phone;
									this.s3 = this.ss[1].userid;
									this.s4 = this.ss[1].phone;
									$('#s1').val(this.s1)
									$('#s2').val(this.s2)
									$('#s3').val(this.s3)
									$('#s4').val(this.s4)
								}
								if(this.ss.length == 3 ){
									this.s1 = this.ss[0].userid;
									this.s2 = this.ss[0].phone;
									this.s3 = this.ss[1].userid;
									this.s4 = this.ss[1].phone;
									this.s5 = this.ss[2].userid;
									this.s6 = this.ss[2].phone;
									$('#s1').val(this.s1)
									$('#s2').val(this.s2)
									$('#s3').val(this.s3)
									$('#s4').val(this.s4)
									$('#s5').val(this.s5)
									$('#s6').val(this.s6)
								}								
							},
							error:function(data){
								console.log(data)
							}
						});
					},
					gbtwo:function(){
						$('#tantwo').css('display','none');
					}

				}
			})			
		})
	</script>
</html>

